home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / demos / VisualAge for Java 2.0 Entry / setup / data1.cab / ide-e / IDE / cache / W7RTJB (.txt) < prev    next >
Encoding:
Java Class File  |  1998-09-16  |  2.7 KB  |  95 lines

  1. package com.sun.java.swing.plaf.metal;
  2.  
  3. import com.sun.java.swing.ButtonModel;
  4. import com.sun.java.swing.Icon;
  5. import com.sun.java.swing.JRadioButton;
  6. import com.sun.java.swing.plaf.UIResource;
  7. import java.awt.Color;
  8. import java.awt.Component;
  9. import java.awt.Graphics;
  10. import java.io.Serializable;
  11.  
  12. class MetalIconFactory$RadioButtonIcon implements Icon, UIResource, Serializable {
  13.    // $FF: renamed from: rb com.sun.java.swing.JRadioButton
  14.    JRadioButton field_0;
  15.    ButtonModel model;
  16.    boolean drawDot;
  17.    Color background;
  18.    Color shadow;
  19.    Color darkCircle;
  20.    Color dotColor;
  21.    Color interiorColor;
  22.    Color whiteInnerLeftArc;
  23.    Color whiteOuterRightArc;
  24.  
  25.    public void paintIcon(Component c, Graphics g, int x, int y) {
  26.       this.field_0 = (JRadioButton)c;
  27.       this.model = this.field_0.getModel();
  28.       this.drawDot = this.model.isSelected();
  29.       this.background = c.getBackground();
  30.       this.dotColor = c.getForeground();
  31.       this.shadow = MetalLookAndFeel.getControlShadow();
  32.       this.darkCircle = MetalLookAndFeel.getControlDarkShadow();
  33.       this.whiteInnerLeftArc = MetalLookAndFeel.getControlHighlight();
  34.       this.whiteOuterRightArc = MetalLookAndFeel.getControlHighlight();
  35.       this.interiorColor = this.background;
  36.       if (!this.model.isEnabled()) {
  37.          this.whiteInnerLeftArc = this.whiteOuterRightArc = this.background;
  38.          this.darkCircle = this.dotColor = this.shadow;
  39.       } else if (this.model.isPressed() && this.model.isArmed()) {
  40.          this.whiteInnerLeftArc = this.interiorColor = this.shadow;
  41.       }
  42.  
  43.       g.translate(x, y);
  44.       g.setColor(this.interiorColor);
  45.       g.fillRect(2, 2, 9, 9);
  46.       g.setColor(this.darkCircle);
  47.       g.drawLine(4, 0, 7, 0);
  48.       g.drawLine(8, 1, 9, 1);
  49.       g.drawLine(10, 2, 10, 3);
  50.       g.drawLine(11, 4, 11, 7);
  51.       g.drawLine(10, 8, 10, 9);
  52.       g.drawLine(9, 10, 8, 10);
  53.       g.drawLine(7, 11, 4, 11);
  54.       g.drawLine(3, 10, 2, 10);
  55.       g.drawLine(1, 9, 1, 8);
  56.       g.drawLine(0, 7, 0, 4);
  57.       g.drawLine(1, 3, 1, 2);
  58.       g.drawLine(2, 1, 3, 1);
  59.       g.setColor(this.whiteInnerLeftArc);
  60.       g.drawLine(2, 9, 2, 8);
  61.       g.drawLine(1, 7, 1, 4);
  62.       g.drawLine(2, 2, 2, 3);
  63.       g.drawLine(2, 2, 3, 2);
  64.       g.drawLine(4, 1, 7, 1);
  65.       g.drawLine(8, 2, 9, 2);
  66.       g.setColor(this.whiteOuterRightArc);
  67.       g.drawLine(10, 1, 10, 1);
  68.       g.drawLine(11, 2, 11, 3);
  69.       g.drawLine(12, 4, 12, 7);
  70.       g.drawLine(11, 8, 11, 9);
  71.       g.drawLine(10, 10, 10, 10);
  72.       g.drawLine(9, 11, 8, 11);
  73.       g.drawLine(7, 12, 4, 12);
  74.       g.drawLine(3, 11, 2, 11);
  75.       if (this.drawDot) {
  76.          g.setColor(this.dotColor);
  77.          g.fillRect(4, 4, 4, 4);
  78.          g.drawLine(4, 3, 7, 3);
  79.          g.drawLine(8, 4, 8, 7);
  80.          g.drawLine(7, 8, 4, 8);
  81.          g.drawLine(3, 7, 3, 4);
  82.       }
  83.  
  84.       g.translate(-x, -y);
  85.    }
  86.  
  87.    public int getIconWidth() {
  88.       return 13;
  89.    }
  90.  
  91.    public int getIconHeight() {
  92.       return 13;
  93.    }
  94. }
  95.